'use strict';

goog.provide('Blockly.Python.Data');

goog.require('Blockly.Python');



// Blockly.Python.data_variable = function() {
//   // Variable setter.
//
//   var varName = Blockly.Python.variableDB_.getName(this.getFieldValue('VARIABLE'),
//       Blockly.Variables.NAME_TYPE);
//   Blockly.Python.setups_['setup_var' + varName] = varName + '\n';
//   return '';
// };


Blockly.Python.data_variable = function() {
  // Variable getter.
  var pin=this.getFieldValue('VARIABLE');

  var varName = Blockly.Python.variableDB_.getName(pin,
      Blockly.VARIABLE_CATEGORY_NAME);
  var code=varName;
  return [code, Blockly.Python.ORDER_ATOMIC];
};


Blockly.Python.data_setvariableto = function() {
  // Variable setter.
  var argument0 = Blockly.Python.valueToCode(this, 'VALUE',
      Blockly.Python.ORDER_NONE) || 0;
  var varName = Blockly.Python.variableDB_.getName(this.getFieldValue('VARIABLE'),
      Blockly.VARIABLE_CATEGORY_NAME);
  var new_arg=argument0;
  return  varName + ' = ' + new_arg +'\n';
};


Blockly.Python.data_changevariableby = function() {
  // Variable setter.
  var argument0 = Blockly.Python.valueToCode(this, 'VALUE',
      Blockly.Python.ORDER_NONE) || '0';
  var varName = Blockly.Python.variableDB_.getName(this.getFieldValue('VARIABLE'),
      Blockly.VARIABLE_CATEGORY_NAME);
  var new_arg=argument0;
  return varName + ' = ' + new_arg +'\n';
};


